import 'dart:io';

import 'package:flutter/material.dart';

void main() {
  runApp(new BottomSheetPlugin());
}

/*
 * 底部滑出 <br/>
 * 需要传入的键：<br/>
 * 传入的值类型： <br/>
 * 传入的值含义：<br/>
 * 是否必传 ：
 */
class BottomSheetPlugin extends StatefulWidget {
  State<StatefulWidget> createState() {
    return new BottomSheetPluginState();
  }
}

/*
 * 页面功能 <br/>
 */
class BottomSheetPluginState extends State<StatefulWidget> {
  double rating = 0;

  void initState() {
    super.initState();
  }

  Widget build(BuildContext contexta) {
    AppBar appBar = AppBar(
      leading: new IconButton(
        icon: new Icon(Icons.arrow_back),
        onPressed: () {},
      ),
      title: new Text('FlutterDesign'),
      centerTitle: true,
      actions: <Widget>[
        new Container(width: 0, height: 0),
        new Container(width: 0, height: 0),
      ],
      backgroundColor: Colors.blue,
    );

    return MaterialApp(
      home: new Scaffold(
        appBar: appBar,
        body: new Builder(builder: (BuildContext context) {
          return RaisedButton(
            child: Text('bottomSheeet'),
            onPressed: () {
              createShowModalBottomSheet(context);
            },
          );
        }),
        backgroundColor: Colors.white,
        bottomNavigationBar: null,
      ),
    );
  }

  /*
   * 创建选择相册还是相机的一个BottomSheet,context需要自己定制
   */
  void createShowModalBottomSheet(context) {
    showModalBottomSheet(
        context: context,
        builder: (BuildContext context) {
          return new Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              new ListTile(
                title: new Text("拍照"),
                onTap: () {},
              ),
              new ListTile(
                title: new Text("从手机相册选择"),
                onTap: () {},
              ),
            ],
          );
        });
  }
}
